import React,{useState, useEffect,useContext} from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { DictContext } from '../../context/context';



function DictTag({ dictType, value, options}) {
    //console.log('=====DictTag==value===',options);
  const getLabel = (type, val, options) => {
   
    if(options.value) {
        const item = options.value.find(item => item.value === val);
        //console.log('=====getLabel==value===');
        return item ? item.label : '';
    } else {
        const item = options.find(item => item.value === val);
        //console.log('=====getLabel==novalue===');
        return item ? item.label : ' ';
    }
  
  };
  return (
    <span>{getLabel(dictType, value, options)}</span>
  );
}

export default DictTag;